import {View, Text} from 'react-native';
import React from 'react';
import RouteIndex from './routes';
import {connect} from 'react-redux';
import {createNativeStackNavigator} from '@react-navigation/native-stack';

import LoginScreen from './screens/NoAuth/login';
import RegisterScreen from './screens/NoAuth/register';
const Stack = createNativeStackNavigator();
const mapStateToProps = state => {
  return {
    isLogin: state.userOp.isLogin,
  };
};
function index({isLogin}) {
  console.log(isLogin);
  return (
    <>
      {isLogin ? (
        <RouteIndex />
      ) : (
        <Stack.Navigator>
          <Stack.Screen name="Login" component={LoginScreen} />
          <Stack.Screen name="Register" component={RegisterScreen} />
        </Stack.Navigator>
      )}
    </>
  );
}
export default connect(mapStateToProps)(index);
